const express = require("express");
const router = express.Router();
const validateRequest = require("../middlewares/validationMiddleware"); // 验证器
// 检验器
const { getProductList_validation, getProductDetail_validation, addProduct_validation, editProduct_validation } = require("../validators/product");
// 控制器
const { product_list, product_detail, product_add, product_update, product_delete } = require("../controllers/product");

router.get("/getProductList", getProductList_validation, validateRequest, product_list); // 产品列表
router.get("/getProductDetail", getProductDetail_validation, validateRequest, product_detail); // 产品详情
router.post("/addProduct", addProduct_validation, validateRequest, product_add); // 添加产品
router.put("/updateProduct", editProduct_validation, validateRequest, product_update); // 更新产品
router.delete("/deleteProduct", getProductDetail_validation, validateRequest, product_delete); // 删除产品

module.exports = router;
